using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    /// <summary>
    /// 类名 : API - UIHeroInfo 界面
    /// 作者 : Canyon / 龚阳辉
    /// 日期 : 2024-05-29 14:07
    /// 功能 : 
    /// </summary>
    public static class APIUIHeroInfo
    {
        static public string ConvertRoman1To5(int num)
        {
            return num switch
            {
                0 => "0",
                1 => "Ⅰ",
                2 => "Ⅱ",
                3 => "Ⅲ",
                4 => "Ⅳ",
                5 => "Ⅴ",
                _ => "",
            };
        }

        /// <summary>
        /// 获取页签文本内容
        /// </summary>
        /// <param skinName="tab"></param>
        /// <returns>页面名</returns>
        static public string GetTabName(int tab)
        {
            return (UIHeroInfoTabType)tab switch
            {
                UIHeroInfoTabType.Overview => "总览",
                UIHeroInfoTabType.Equip => "装备",
                UIHeroInfoTabType.UpLevel => "升级",
                UIHeroInfoTabType.UpStar => "升星",
                UIHeroInfoTabType.Skill => "技能",
                UIHeroInfoTabType.FateTrajectory => "缘轨",
                _ => "",
            };
        }

        static public string GetTabEnName(int tab)
        {
            UIHeroInfoTabType em = (UIHeroInfoTabType)tab;
            return em switch
            {
                UIHeroInfoTabType.MaxLength => "",
                _ => em.ToString(),
            };
        }

        /// <summary>
        /// 取得页签对应的模块的预制体资源路径
        /// </summary>
        static public string GetTabPrefabAssetPath(int tab)
        {
            int cid = 100000 + tab;
            return APITableConfig.GetCfgResouceUrl(cid);
        }

        /// <summary>
        /// 获取下一级的经验文字
        /// </summary>
        static public string GetNextExpStr(int exp, bool isMax)
        {
            isMax = isMax || (exp < 0);
            if (isMax)
                return APIUIConst.GetMaxLabel();
            return "Next:" + exp;
        }

        /// <summary>
        /// 简要属性Ids(Attribute表里面的)
        /// </summary>
        static readonly public int[] BasicAttributeIds = { 2, 3, 4, 5 };
        /// <summary>
        /// 详显示的详细属性Ids(Attribute表里面的)
        /// </summary>
        static readonly public int[] DetailAttributeIds = { 2, 3, 4, 5, 6, 8, 10, 11, 12, 13 };

        static readonly public int[] UpLevelShowAttributeIds = { 2, 3, 4 };

        /// <summary>
        /// 特性解锁提示
        /// </summary>
        static public string GetFeatureUnlockStr(int unlockStar)
        {
            return string.Format("星数{0}解锁", unlockStar);
        }

        /// <summary>
        /// 默认技能长度(取前面4个)
        /// </summary>
        static public int DefaultSkillCount => 4;

        /// <summary>
        /// 技能升级默认选中的槽位位置 (SkillSlot)
        /// </summary>
        static public int DefaultUpSkillSlot => 4;

        /// <summary>
        /// 升级消耗(升级道具|单个道具提供经验)
        /// </summary>
        static public IReadOnlyList<int> UpLvCostItems => TableCenter.global.HeroUpLvCostItems;

        /// <summary>
        /// 消耗(道具ID（金币）|道具数量) / 1点经验
        /// </summary>
        static public IReadOnlyList<int> UpLvCostMoney => TableCenter.global.HeroUpLvCostMoney;

        /// <summary>
        /// 每个英雄升级消耗的长度
        /// </summary>
        static public int OneUpHeroLvCostCount => APIUIConst.CostDefaultSpacing;

        static public string GetAwakenLevelTitle(int awakenLv)
        {
            return string.Format("觉醒等级{0}", ConvertRoman1To5(awakenLv));
        }

        static public string GetAwakenUnlockSkin(string skinName)
        {
            return string.Format("解锁皮肤：{0}", skinName);
        }

        static public string GetAwakenUnlockSkill(string skinName)
        {
            return string.Format("解锁打工技能：{0}", skinName);
        }

        static public string GetStrUpHeroAwakenCondition(int maxHeorLv, bool isFinshedUp)
        {

            return isFinshedUp ? "已完成强化" : string.Format("需要角色升级到{0}", maxHeorLv);
        }

        static public string GetStrSkillType(int skillType)
        {
            // 技能类型1普攻 2技能 3奥义 4被动
            return skillType switch
            {
                1 => "普攻",
                2 => "技能",
                3 => "奥义", // 大招？
                4 => "被动",
                _ => "",
            };
        }

        static public string GetStrUseSkillCost(int cost)
        {
            return cost > 0 ? string.Format("消耗：<color=blue>{0} 怒气值</color>", cost) : "消耗：无";
        }

        static public string GetStrUseSkillCooldown(int cooldown)
        {
            return cooldown > 0 ? string.Format("冷却：<color=red>{0} 回合</color>", cooldown) : "冷却：无";
        }

        static public string GetStateStrUnlockSkill(int needHeroLv)
        {
            return string.Format("<color=red>解锁等级：{0}</color>", needHeroLv);
        }

        static public string GetStateStrMaxLv()
        {
            return $"已达到最大等级";
        }

        static public string GetStateStrUpSkill(int needHeroLv)
        {
            return string.Format("<color=red>需要英雄等级：{0}</color>", needHeroLv);
        }

        static public string GetStrSkillLevel(int level, bool isMax)
        {
            return isMax ? APIUIConst.GetMaxLabel() : ((level > 1) ? $"+{level - 1}" : "0");
        }

        /// <summary>
        /// 英雄技能升级成功提示
        /// </summary>
        static public readonly int NoticeCid_SuccesUpHeroSkill = 20030;

        /// <summary>
        /// 已装备同名装备
        /// </summary>
        static public readonly int NoticeCid_SameCidEquip = 20051;

        /// <summary>
        /// 是否将 {0} 中装备{1}穿戴到{2}身上
        /// </summary>
        static public readonly int NoticeCid_WearOtherHeroEquip = 20052;

        /// <summary>
        /// 是否将穿戴的装备、宠物卸下？
        /// </summary>
        static public readonly int NoticeCid_TakeOffAllEquipsAndPets = 20053;

        /// <summary>
        /// 当前未穿戴装备、宠物
        /// </summary>
        static public readonly int NoticeCid_TakeOffAllWhenNoWears = 20054;

        /// <summary>
        /// 英雄等级{0}时解锁
        /// </summary>
        static public readonly int NoticeCid_UnlockByHeroLevel = 20055;

        /// <summary>
        /// 是否将 {0} 中宠物{1}更换到{2}身上
        /// </summary>
        static public readonly int NoticeCid_WearOtherHeroPet = 20056;

        static public int MaxHeroEquipColumn => TableCenter.global.MaxHeroEquipColumn;
        static public IReadOnlyList<int> LimitLvUnlockHeroEquipColumns => TableCenter.global.LimitLvUnlockHeroEquipColumns;
        static public int LimitLvUnlockHeroPetColumn => TableCenter.global.LimitLvUnlockHeroPetColumn;

        static public string GetHeroEquipColumnUnlockStr(int unlockLv)
        {
            return string.Format("等级{0}解锁", unlockLv);
        }

        static public string GetHeroPetColumnUnlockStr(int unlockLv)
        {
            return string.Format("等级{0}解锁", unlockLv);
        }

        static public string GetHeroFateTrajectoryStageUnlockStr(int unlockLv)
        {
            return string.Format("等级{0}解锁", unlockLv);
        }
    }
}
